﻿<navigation:Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:my1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:my="clr-namespace:AdminApp.Web.Services"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:my2="clr-namespace:System.Windows.Data;assembly=System.Windows.Controls.Ria" xmlns:AdminApp_Controls="clr-namespace:AdminApp.Controls"
    x:Class="AdminApp.Views.Rooms"
    d:DesignWidth="644"
    d:DesignHeight="408"
    Title="Rooms Page"
    >
    <my1:BusyIndicator
        IsBusy="{Binding DomainContext.IsLoading, ElementName=eventDomainDataSource}">
        <my1:BusyIndicator
            IsBusy="{Binding DomainContext.IsLoading, ElementName=roomDomainDataSource}">

            <Grid
                x:Name="LayoutRoot">

                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="30" />
                    <RowDefinition />
                    <RowDefinition
                        Height="49" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="300" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <riaControls:DomainDataSource
                    AutoLoad="True"
                    Height="0"
                    LoadedData="eventDomainDataSource_LoadedData"
                    x:Name="eventDomainDataSource"
                    QueryName="GetEventQuery"
                    Width="0"
                    Margin="160,82,160,120"
                    Grid.Row="1">
                    <riaControls:DomainDataSource.DomainContext>
                        <my:DigitalSignageDomainContext />
                    </riaControls:DomainDataSource.DomainContext>
                </riaControls:DomainDataSource>

                <riaControls:DomainDataSource
                    AutoLoad="True"
                    Height="0"
                    LoadedData="roomDomainDataSource_LoadedData"
                    x:Name="roomDomainDataSource"
                    QueryName="GetRoom"
                    Width="0"
                    Margin="160,82,160,120"
                    Grid.Row="1">
                    <riaControls:DomainDataSource.DomainContext>
                        <my:DigitalSignageDomainContext />
                    </riaControls:DomainDataSource.DomainContext>
                </riaControls:DomainDataSource>
                <StackPanel
                    Margin="8,4"
                    Orientation="Horizontal"
                    d:LayoutOverrides="Height"
                    Grid.ColumnSpan="2">

                    <TextBlock
                        x:Name="_eventLabel"
                        TextWrapping="Wrap"
                        Text="Event"
                        VerticalAlignment="Center"
                        Margin="0,0,4,0" />

                    <ComboBox
                        x:Name="_eventCombo"
                        ItemsSource="{Binding Data, ElementName=eventDomainDataSource}"
                        DisplayMemberPath="Name"
                        Width="243"
                        Margin="0" />

                </StackPanel>

                <data:DataGrid
                    AutoGenerateColumns="False"
                    Grid.ColumnSpan="1"
                    Grid.RowSpan="1"
                    HorizontalAlignment="Stretch"
                    ItemsSource="{Binding Data, ElementName=roomDomainDataSource}"
                    Margin="8"
                    x:Name="roomDataGrid"
                    RowDetailsVisibilityMode="VisibleWhenSelected"
                    DataContext="{Binding DomainContext.Rooms, ElementName=roomDomainDataSource, Mode=TwoWay}"
                    Grid.Row="1">
                    <data:DataGrid.Columns>

                        <data:DataGridTextColumn
                            x:Name="nameColumn"
                            Binding="{Binding Name}"
                            Header="Name"
                            Width="200" />

                        <data:DataGridTextColumn
                            x:Name="descriptionColumn"
                            Binding="{Binding Description}"
                            Header="Description"
                            Width="300" />
                    </data:DataGrid.Columns>
                </data:DataGrid>
                <Grid
                    DataContext="{Binding Data, ElementName=roomDomainDataSource}"
                    Grid.Row="1"
                    Margin="8"
                    x:Name="_detailsGrid" Grid.Column="1" d:LayoutOverrides="GridBox">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition
                            Width="74" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="31" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <dataInput:Label
                        Content="Description:"
                        Grid.Column="0"
                        Grid.Row="1"
                        HorizontalAlignment="Left"
                        Margin="3"
                        VerticalAlignment="Top" />
                    <TextBox
                        Grid.Column="1"
                        Grid.Row="1"
                        Margin="4,4,4,0"
                        x:Name="descriptionTextBox"
                        Text="{Binding Description, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />

                    <dataInput:Label
                        Content="Name:"
                        Grid.Column="0"
                        Grid.Row="0"
                        HorizontalAlignment="Left"
                        Margin="3"
                        VerticalAlignment="Center" />
                    <TextBox
                        Grid.Column="1"
                        Grid.Row="0"
                        Margin="3"
                        x:Name="nameTextBox"
                        Text="{Binding Name, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
                </Grid>

                <StackPanel
                    HorizontalAlignment="Left"
                    Margin="10,0,0,9"
                    x:Name="_addRemove"
                    VerticalAlignment="Bottom"
                    Orientation="Horizontal"
                    Grid.Row="2">
                    <Button
                        Content="Add Room"
                        x:Name="_addRoom"
                        Click="_addRoom_Click" />
                    <Button
                        Content="Remove Room"
                        x:Name="_removeRoom"
                        Click="_removeRoom_Click" />
                </StackPanel>

                <StackPanel
                    x:Name="_saveReject"
                    Margin="0,0,8,8"
                    Orientation="Horizontal"
                    VerticalAlignment="Bottom"
                    Grid.Column="1"
                    Grid.Row="2"
                    HorizontalAlignment="Right"/>

            	<AdminApp_Controls:SaveAndRejectControl
            		Grid.Column="1"
            		Margin="0"
            		Grid.Row="2"
            		DataContext="{Binding ElementName=roomDomainDataSource}" HorizontalAlignment="Right" VerticalAlignment="Bottom" d:LayoutOverrides="VerticalAlignment" />

            </Grid>
        </my1:BusyIndicator>
    </my1:BusyIndicator>
</navigation:Page>
